package patterns.mvc;

/**
 * Created by thinkpad on 16-12-11.
 * 控制器类，用于控制数据和视图显示
 */
public class StudentController {
    private Student model;
    private StudentView view;
    //获得数据，构造函数
    public StudentController(Student model,StudentView view){
        this.model = model;
        this.view = view;
    }
    //更新视图
    public void updateView(){
        view.printStudentDetails(model.getName(),model.getRollNo());
    }

    public String getStudentName() {
        return model.getName();
    }

    public void setStudentName(String name) {
       model.setName(name);
    }

    public String getStudentRollNo() {
        return model.getRollNo();
    }

    public void setStudentRollNo(String rollNo) {
        model.setRollNo(rollNo);
    }
}
